namespace Combobox控件下拉文本框
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            comboBox1.SelectedIndex = 1; //设定下拉框的默认值
            comboBox1.DropDownStyle = ComboBoxStyle.DropDownList;//DropDownList 下拉框文本不可编辑
                                                                 //DropDown 下拉框文本可编辑
        }

        /// <summary>
        /// 显示下拉框值
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button1_Click(object sender, EventArgs e)
        {
            MessageBox.Show(comboBox1.SelectedItem.ToString());
        }
        /// <summary>
        /// 显示下拉框索引
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button2_Click(object sender, EventArgs e)
            {
            MessageBox.Show(comboBox1.SelectedIndex.ToString());
        }
}    }   

//如果选择某项后，需要在此基础上修改，需要用comboBox1.Text，否则报错：未引用的对象
//comboBox1.Text
